package cn.sciento.transfer.api.controller.v1;

import cn.sciento.swagger.annotation.Permission;
import io.swagger.annotations.ApiOperation;
import cn.sciento.core.base.BaseController;
import cn.sciento.core.util.Results;
import cn.sciento.transfer.app.service.EventSendService;
import cn.sciento.transfer.domain.entity.EventSend;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("eventSendController.v1")
@RequestMapping({"/v1/event-sends"})
public class EventSendController extends BaseController {
  @Autowired
  private EventSendService eventSendService;
  
  @ApiOperation("创建待发消息事件")
  @Permission(permissionLogin = true, permissionWithin = true)
  @PostMapping
  public ResponseEntity<EventSend> createEventSend(@RequestBody EventSend eventSend) {
    EventSend result = this.eventSendService.insertEventSend(eventSend);
    return Results.success(result);
  }
}
